package com.zz.ecommerce.declareManage.importB2CDeclareDirect.personalDeclMgnInsp;

import com.zz.ecommerce.common.GridRequest;
import com.zz.ecommerce.common.GridResult;
import com.zz.ecommerce.common.bean.insp.db.declaration.TDeclareFormHeadInsp;
import com.zz.ecommerce.common.constants.CommonConstant;
import com.zz.ecommerce.common.constants.CommonConstants;
import com.zz.ecommerce.declareManage.common.service.TDeclareFormHeadInspService;
import com.zz.ecommerce.utils.SessionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * 个人申报清单Controller
 * <p/>
 * Created by zhangguowei on 2016/3/28.
 */
@Controller
@RequestMapping("/importB2CDirect/personalDeclInsp")
@Scope("prototype")
public class PersonalDeclDirectInspController {

    @Autowired
    private TDeclareFormHeadInspService tDeclareFormHeadInspService;

    /**
     * 申报清单管理
     *
     * @return
     */
    @RequestMapping(value = "declarationForm", method = {RequestMethod.GET})
    public String declarationForm() {
        return "declareManage/importB2CDeclareDirect/personalDeclInsp/declaration_form";
    }

    /**
     * 查询申报清单管理列表
     *
     * @param tDeclareFormHeadInsp
     * @param request
     * @return
     */
    @RequestMapping("/queryDeclareList")
    @ResponseBody
    public GridResult queryDeclareList(TDeclareFormHeadInsp tDeclareFormHeadInsp, GridRequest request, HttpSession session) {
        tDeclareFormHeadInsp.setOrgId(SessionUtil.getOrganizationId(session));
        return new GridResult(tDeclareFormHeadInspService.queryDeclListInsp(request, tDeclareFormHeadInsp, CommonConstants.I_FALG, CommonConstant.BIZ_TYPE_DIRECT), request, tDeclareFormHeadInspService.countDeclInsp(tDeclareFormHeadInsp, CommonConstants.I_FALG, CommonConstant.BIZ_TYPE_DIRECT));
    }

}
